﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ChangeTheme
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void ToggleButton_Checked(object sender, RoutedEventArgs e)
        {
            Application.Current.Resources.MergedDictionaries.Clear();
            if ((sender as ToggleButton)?.IsChecked == true)
                Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("Themes/DarkTheme.xaml", UriKind.Relative)) as ResourceDictionary);
            else
                Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("Themes/LightTheme.xaml", UriKind.Relative)) as ResourceDictionary);
        }
    }
}